package voice.main;

import java.util.ArrayList;
import util.TaskHelper;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ApplicationsActivity  extends ListActivity  {
	private ArrayAdapter<String> adapter;
	private ArrayList<String> appList;
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ArrayList<String> values = new ArrayList<String>();
        
        adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, 
        									android.R.id.text1, values);
        setListAdapter(adapter);
        
        appList = getIntent().getStringArrayListExtra("APPS_LIST");
        
        for (String app : appList) {
    		adapter.add(app);
        }
    }
	
	@Override
	  protected void onListItemClick(ListView l, View v, int position, long id) {
	    TaskHelper.openApplications(getApplicationContext(), appList.get(position));
	}
}
